﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master/Admin.Master" AutoEventWireup="true"
    CodeBehind="ImgsList.aspx.cs" Inherits="Besture.UI.Admin.Content.ImgsList" %>

<%@ Import Namespace="Besture.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <div class="listPage">
        <!-- Begin 操作条 -->
        <div class="operateBar">
            <ul>
                <li><a id="checkall" href="javascript:void(0);" class=""><s class="icon-gou-gray"></s>
                    全选</a></li>
                <li><a id="delcheckall" href="javascript:void(0);" class=""><s class="icon-cancel-gray">
                </s>取消</a></li>
                <li><a onclick="DeleteSelect('')" href="javascript:void(0);" class=""><s class="icon-delete-gray">
                </s>删除</a></li>
                <li><a href="ImgsSet.aspx?partid=<%=PartID %>" class=""><s class="icon-add-gray"></s>添加</a></li>
            </ul>
        </div>
        <!-- //End 操作条 -->
        <div class="gridList">
            <ul>
                <cms:Repeater ID="Rp201405161545275311" runat="server" DataName="" Sql="SELECT * FROM dbo.TBPartContent pc WHERE pc.PartID=15 AND pc.IsDisplay=0 ORDER BY pc.CreateTime DESC ">
                    <ItemTemplate>
                        <li>
                            <img src="<%# Constants.PATH_IMAGE_CONTENT+DataBinder.Eval(Container.DataItem,"ImageUrl") %>"
                                width="170" height="130" />
                            <div>
                                <%# DataBinder.Eval(Container.DataItem,"Name") %></div>
                            <div class="operateBox">
                                <input class="select_single" type="checkbox" name="checkname" value="<%#DataBinder.Eval(Container.DataItem,"ID") %>" />
                                <a class="btn-text" href="ImgsSet.aspx?id=<%# DataBinder.Eval(Container.DataItem,"ID") %>&partid=<%=PartID %>" title="编辑">编辑</a>|
                                <a class="btn-text" onclick="DeleteSelect('<%#DataBinder.Eval(Container.DataItem,"ID") %>')" href="javascript:void(0);" title="删除">删除</a>
                            </div>
                        </li>
                    </ItemTemplate>
                </cms:Repeater>
            </ul>
            <div class="pageList-wrap">
                <%-- <div class="fl page-info">
                    <p>
                        共有<b>1256</b>条记录，当前显示第 <b>2</b> 页</p>
                </div>--%>
                <div class="fr pageList" style="width: 100%;">
                    <cms:Pager ID="Pager201404231300460925" ShowFirstLast="False" PrevPageText="<" NextPageText=">"
                        CurrentPageButtonClass="prev" ContentPlaceHolder="Content" runat="server" RepeaterID="Rp201405161545275311"
                        PageSize="15" />
                </div>
            </div>
        </div>
    </div>
    <!-- //End 主内容区 -->
    <script type="text/javascript">
        $(function () {
            //全选
            $("#checkall").click(function () {
                $("input[name='checkname']").each(function () {
                    $(this).attr("checked", true);
                });
            });
            //取消全选
            $("#delcheckall").click(function () {
                $("input[name='checkname']").each(function () {
                    $(this).attr("checked", false);
                });
            });
        });


        //删除选中项
        function DeleteSelect(id) {
            if (!confirm("删除后无法恢复，确定删除选中项吗？")) {
                return;
            }
            var select = "";
            $("input[name='checkname']").each(function () {
                if ($(this).attr("checked")) {
                    select += $(this).val() + ",";
                }
            });
            if (select.length>0 || id.length>0) {
                var paramter = {};
                paramter.ids = select;
                paramter.id = id;
                $.ajax({
                    type: "POST",
                    url: "/Admin/Content/ImgsList.aspx/DeleteSelect",
                    data: JSON.stringify(paramter),
                    contentType: "application/json",
                    dataType: "json",
                    success: GetDelete
                });
            }
        }

        //异步返回函数
        function GetDelete(data) {
            if (data["d"]=="1") {
                alert("删除成功！");
                location.href = window.location.href;
            } else {
                alert("删除失败！");
            }
        }

    </script>
</asp:Content>
